package com.example.ercmssystem2.repository;

import com.example.ercmssystem2.entity.TaskReport;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

@Repository
public interface TaskReportRepository extends JpaRepository<TaskReport, Long> {
    // 查找事件的所有报告
    List<TaskReport> findByEventIdOrderByReportTimeDesc(Long eventId);
    // 查找特定时间范围内的报告
    List<TaskReport> findByReportTimeBetweenOrderByReportTimeDesc(LocalDateTime start, LocalDateTime end);
    // 查找用户的所有报告
    List<TaskReport> findByReportedByOrderByReportTimeDesc(Long reportedBy);
    // 统计事件报告数量
    long countByEventId(Long eventId);
    // 统计特定时间范围内的报告数量
    long countByReportTimeBetween(LocalDateTime start, LocalDateTime end);
} 